#ifndef GXFR_PLAYER_CONTROLLER_H
#define GXFR_PLAYER_CONTROLLER_H

#include "Basic/GxLibBasic.h"
#include "LibGL/GxMath3D.h"

class NxPhysicsSDK;
class NxScene;
class NxController;

namespace FinalRendering
{
	namespace Engine
	{
		class Engine;

		namespace Physics
		{
			class ControllerHitReport;

			class PlayerController : Object
			{
			private:
				ControllerHitReport * hitReport;
				NxController * ctrl;
				Engine * engine;
				vec3 curSpeed;
				bool jumping;
				float ySpeed;
				float jumpElapsedTime;
				bool CollisionDown, CollisionUp, CollisionSide;
			public:
				float MoveSpeed;
				float CrouchedMoveSpeed;
				float DampAcceleration;
				float MoveAcceleration;
				float GravityAcceleration;
				float JumpSpeed;
				void MoveDirection(const vec3 & dir, float dTime);
				bool IsOnGround();
				bool CanStand();
				void Crouch();
				void Stand();
				void Jump();
				vec3 GetPosition();
			public:
				PlayerController(Engine * engine, NxScene * scene, const vec3 & initPos);
				~PlayerController();
			};
		}
	}
}

#endif